import 'package:aihu_getx_app/app/modules/commons/commons.dart';
import 'package:aihu_getx_app/utils/constants.dart';
import 'package:aihu_getx_app/widgets/common_image.dart';
import 'package:aihu_getx_app/widgets/my_icon_font.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

import '../controllers/e_my_controller.dart';

class EMyView extends GetView<EMyController> {
  const EMyView({super.key});

  @override
  Widget build(BuildContext context) {
    return Obx(
      () => Scaffold(
        appBar: Commons.appBar(
          title: controller.title,
          subTitle: controller.appName.value,
        ),
        body: Container(
          color: Colors.white,
          width: Get.width,
          height: Get.height,
          padding: const EdgeInsets.all(10),
          child: Obx(
            () => RefreshIndicator(
              color: Get.theme.primaryColorLight,
              backgroundColor: Get.theme.primaryColor,
              onRefresh: controller.onRefresh,
              child: ListView(
                children: [
                  GestureDetector(
                    child: Row(
                      children: [
                        CommonImage(
                          controller.userProfile.value.avatar ?? Constants.icon,
                          width: 100,
                          height: 100,
                          isCircle: true,
                        ),
                        const SizedBox(width: 10),
                        Expanded(
                          child: Column(
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: [
                              Text(
                                '${controller.userProfile.value.nickname}',
                                style: Get.textTheme.titleLarge,
                              ),
                              Text(
                                '手机号: ${controller.userProfile.value.mobile ?? ''}',
                                style: Get.textTheme.bodyMedium,
                              ),
                            ],
                          ),
                        ),
                        const Icon(
                          Icons.qr_code,
                        ),
                        const Icon(
                          Icons.keyboard_arrow_right,
                        ),
                      ],
                    ),
                    // onTap: () => Get.toNamed(Routes.dIndex),
                  ),
                  Divider(
                    height: 20,
                    color: Get.theme.primaryColorLight,
                  ),
                  ListTile(
                    leading: const Icon(
                      Icons.shopping_cart,
                    ),
                    title: Text(
                      '我的订单',
                      style: Get.textTheme.titleMedium,
                    ),
                    trailing: const Icon(
                      Icons.keyboard_arrow_right,
                    ),
                    // onTap: () => Get.toNamed(Routes.dMyProfile),
                  ),
                  Row(
                    mainAxisAlignment: MainAxisAlignment.spaceAround,
                    children: [
                      GestureDetector(
                        onTap: () {},
                        child: Column(
                          children: [
                            const Icon(
                              MyIconFont.daifukuan,
                              size: 45,
                              color: Colors.orangeAccent,
                            ),
                            Text(
                              '待付款',
                              style: Get.textTheme.bodyMedium,
                            ),
                          ],
                        ),
                      ),
                      GestureDetector(
                        onTap: () {},
                        child: Column(
                          children: [
                            const Icon(
                              MyIconFont.daijiedan,
                              size: 45,
                              color: Colors.greenAccent,
                            ),
                            Text(
                              '待接单',
                              style: Get.textTheme.bodyMedium,
                            ),
                          ],
                        ),
                      ),
                      GestureDetector(
                        onTap: () {},
                        child: Column(
                          children: [
                            const Icon(
                              MyIconFont.fuwuzhong,
                              size: 45,
                              color: Colors.blueAccent,
                            ),
                            Text(
                              '服务中',
                              style: Get.textTheme.bodyMedium,
                            ),
                          ],
                        ),
                      ),
                      GestureDetector(
                        onTap: () {},
                        child: Column(
                          children: [
                            const Icon(
                              MyIconFont.yiwancheng,
                              size: 45,
                              color: Colors.redAccent,
                            ),
                            Text(
                              '已完成',
                              style: Get.textTheme.bodyMedium,
                            ),
                          ],
                        ),
                      ),
                    ],
                  ),
                  Divider(
                    height: 10,
                    color: Get.theme.primaryColorLight,
                  ),
                  ListTile(
                    leading: const Icon(
                      Icons.perm_identity,
                    ),
                    title: Text(
                      '实名认证',
                      style: Get.textTheme.titleMedium,
                    ),
                    trailing: const Icon(
                      Icons.keyboard_arrow_right,
                    ),
                    // onTap: () => Get.toNamed(Routes.dMyProfile),
                  ),
                  Divider(
                    height: 10,
                    color: Get.theme.primaryColorLight,
                  ),
                  ListTile(
                    leading: const Icon(
                      Icons.wallet,
                    ),
                    title: Text(
                      '我的钱包',
                      style: Get.textTheme.titleMedium,
                    ),
                    trailing: const Icon(
                      Icons.keyboard_arrow_right,
                    ),
                    // onTap: () => Get.toNamed(Routes.dMyProfile),
                  ),
                  Divider(
                    height: 10,
                    color: Get.theme.primaryColorLight,
                  ),
                  ListTile(
                    leading: const Icon(
                      Icons.wechat_outlined,
                    ),
                    title: Text(
                      '社交信息',
                      style: Get.textTheme.titleMedium,
                    ),
                    trailing: const Icon(
                      Icons.keyboard_arrow_right,
                    ),
                    // onTap: () => Get.toNamed(Routes.dMyProfile),
                  ),
                  Divider(
                    height: 10,
                    color: Get.theme.primaryColorLight,
                  ),
                  ListTile(
                    leading: const Icon(
                      Icons.lock_clock_outlined,
                    ),
                    title: Text(
                      '修改密码',
                      style: Get.textTheme.titleMedium,
                    ),
                    trailing: const Icon(
                      Icons.keyboard_arrow_right,
                    ),
                    // onTap: () => Get.toNamed(Routes.dMyProfile),
                  ),
                  Divider(
                    height: 10,
                    color: Get.theme.primaryColorLight,
                  ),
                  ListTile(
                    leading: const Icon(
                      Icons.power_settings_new_rounded,
                    ),
                    title: Text(
                      '退出登录',
                      style: Get.textTheme.titleMedium,
                    ),
                    trailing: const Icon(
                      Icons.keyboard_arrow_right,
                    ),
                    onTap: () => controller.logout(),
                  ),
                ],
              ),
            ),
          ),
        ),
      ),
    );
  }
}
